#include<iostream>
#include<vector>
#include<unordered_set>
#include<string>
using namespace std;

class Solution {
public:
/*
	int lengthOfLongestSubstring(string s) {
		vector<unordered_map<char, int>> maplist;
		for (int i = 0; i < s.length(); i++) {
			unordered_map<char, int> map;
			map[s[i]] = i;
			for (int j = i + 1; j < s.length(); j++) {
				if (map.count(s[j])) {
					maplist.push_back(map);
					break;
				}
				map[s[j]] = j;
			}
		}
		int length = -1,startIndex=-INT_MAX;
		for (unordered_map<char, int> map : maplist) {
			int start=INT_MAX;
			for (auto it = map.begin(); it != map.end(); it++) {
				if (it->second < start)
					start = it->second;
			}
			if (start + map.size() > startIndex + length) {
				length = map.size();
				startIndex = start;
			}
		}
		string res = s.substr(startIndex, length);
		return res.length();

	}
*/
	int lengthOfLongestSubstring(string s) {
		unordered_set<char> groundmap;
		for (int i = 0; i < s.length(); i++) {
			unordered_set<char> map;
			for (int j = i; j < s.length(); j++) {
				if (map.count(s[j])) {
					break;
				}
				map.insert(s[j]);
			}
			if(map.size() > groundmap.size())
				map.swap(groundmap);
		}
		return groundmap.size();
	}

};	



void main() {
	string s = " ";
	Solution so;
	int n=so.lengthOfLongestSubstring(s);
	cout << n << endl;
}